﻿using EPiMVC.UrlRewriting;
using EPiServer;

namespace EPiMVC.Routing
{
    public class RouteConfiguration
    {
        public RouteConfiguration()
        {
            DefaultActionName = "Index";
            ControllerNameConvention = new PageTypeBuilderSafeControllerNameConvention();
        }
        
        public string DefaultActionName { get; set; }

        public IControllerNameConvention ControllerNameConvention { get; set; }

        private IPageResolver pageResolver;
        public IPageResolver PageResolver
        {
            get
            {
                if (pageResolver == null)
                    pageResolver = (IPageResolver) Global.UrlRewriteProvider;

                return pageResolver;
            }
            set
            {
                pageResolver = value;
            }
        }
    }
}
